import { AppBaseEntity } from 'src/shared/database/baseEntity';
import { Column, Entity } from 'typeorm';

@Entity({
  name: 'products',
  comment: '商品表',
})
export class Product extends AppBaseEntity {
  @Column({
    comment: '店铺id',
    name: 'store_id',
  })
  storeId: number;

  @Column({
    comment: '商品名称',
    name: 'name',
  })
  name: string;

  @Column({
    comment: '商品描述',
    name: 'description',
  })
  description: string;

  // 保留两位小数
  @Column({
    comment: '商品价格',
    name: 'price',
    type: 'decimal',
    precision: 10,
    scale: 2,
  })
  price: number;

  @Column({
    comment: '商品图片id',
    name: 'images',
    type: 'simple-array',
  })
  images: number[];
}
